import 'package:boss/textStyle/text_style.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

class RadiusButton extends StatelessWidget {
  final double width;
  final double height;
  final String title;
  final VoidCallback onTap;
  final TextStyle textStyle;
  final Color color;
  final EdgeInsets margin;
  final bool enabled;
  final double radius;

  const RadiusButton({
    Key key,
    this.width,
    this.height,
    this.title,
    this.onTap,
    this.textStyle,
    this.color,
    this.margin,
    this.enabled = true,
    this.radius,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final width = this.width ?? 250.w;
    final height = this.height ?? 80.w;
    final color = this.color ?? Theme.of(context).primaryColor;
    final radius = this.radius ?? height / 2;

    return GestureDetector(
      onTap: enabled ? onTap : null,
      behavior: HitTestBehavior.translucent,
      child: Container(
        width: width,
        height: height,
        margin: margin,
        decoration: BoxDecoration(
          color: color.withOpacity(enabled ? 1 : 0.6),
          borderRadius: BorderRadius.circular(radius),
        ),
        alignment: Alignment.center,
        child: Text(
          title,
          style: textStyle ?? TextStyleConstant().white_32,
        ),
      ),
    );
  }
}
